﻿<!-- 2017-12-4 14:24:11 | 修改 木遥（微信:  http://marsgis.cn/weixin.html ） -->
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="x5-fullscreen" content="true">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />


    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta name="description"
        content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS" />

    <link rel="shortcut icon" type="image/x-icon" href="http://cesium.marsgis.cn/favicon.ico">
    <title>加载OGC WMS 服务地图 |Mars3D ( MarsGIS for Cesium )|三维地图| 火星科技|合肥火星科技|合肥火星科技有限公司</title>




    <script type="text/javascript" src="../lib/include-lib.js" libpath="../lib/"
        include="jquery,font-awesome,bootstrap,layer,haoutil,mars3d"></script>

    <link href="css/style.css" rel="stylesheet" />

</head>

<body class="dark">
    <div id="cesiumContainer" class="mars3d-container"></div>



    <script type="text/javascript">
        $(document).ready(function () {
            if (!mars3d.util.webglreport()) {
                alert('系统检测到您使用的浏览器不支持WebGL功能');
                layer.open({
                    type: 1,
                    title: "当前浏览器不支持WebGL功能",
                    closeBtn: 0,
                    shadeClose: false,
                    resize: false,
                    area: ['600px', '200px'], //宽高
                    content: '<div style="margin: 20px;"><h3>系统检测到您使用的浏览器不支持WebGL功能！</h3>  <p>1、请您检查浏览器版本，安装使用最新版chrome、火狐或IE11以上浏览器！</p> <p>2、WebGL支持取决于GPU支持，请保证客户端电脑已安装显卡驱动程序！</p></div>'
                });
            }
            initMap();
        });


        var viewer
        function initMap() {

            //构造地球
            viewer = new Cesium.Viewer("cesiumContainer", {
                animation: false,        //是否创建动画小器件，左下角仪表
                timeline: false,         //是否显示时间线控件
                geocoder: false,         //是否显示地名查找控件

                baseLayerPicker: true,  //是否显示图层选择控件 
            });


            //火星对viewer的扩展
            viewer.mars = new mars3d.ViewerEx(viewer, {
                contextmenu: true,
                center: { "y": 19.999609, "x": 117.579843, "z": 2709521.51, "heading": 354.1, "pitch": -70.1, "roll": 0.1 },
                mouseZoom: true,
                location: {
                    format: "<div>经度:{x}</div> <div>纬度:{y}</div> <div>海拔：{z}米</div> <div>方向：{heading}度</div> <div>视高：{height}米</div>"
                },
                navigation: {
                    compass: { top: "10px", right: "5px" }
                },
            });




            //增加其他底图 https://www.lightpollutionmap.info/geoserver/gwc/demo 
            var layer = mars3d.layer.createLayer(viewer,{
                "name": "光污染图层",
                "type": "wms",
                "url": "//www.lightpollutionmap.info/geoserver/gwc/service/wms",
                "layers": "PostGIS:VIIRS_2019",
                "crs": "EPSG:3857",
                "parameters": {
                    "transparent": true,
                    "format": "image/png"
                },
                "alpha": 0.6, //透明度
                "proxy": "http://data.marsgis.cn/proxy/",  //代理服务，解决跨域问题
                "visible": true,
            });


            //wms也可以换一种xyz的直接写法
            // var layer = mars3d.layer.createLayer(viewer,{
            //     "type": "tile",
            //     "url": "//www.lightpollutionmap.info/geoserver/gwc/service/wms?transparent=true&format=image%2Fpng&service=WMS&version=1.1.1&request=GetMap&styles=&layers=PostGIS%3AVIIRS_2019&bbox={westProjected},{southProjected},{eastProjected},{northProjected}&width={width}&height={height}&srs=EPSG%3A3857",
            //     "alpha": 0.6, //透明度
            //     "proxy": "http://data.marsgis.cn/proxy/",  //代理服务，解决跨域问题
            //     "visible": true,
            // });



            //增加其他底图 
            var layer = mars3d.layer.createLayer(viewer,{
                "name": "合肥wms",
                "type": "wms",
                "url": "http://data.marsgis.cn/geoserver/mars/wms",
                "layers": "mars:hf",
                "crs": "EPSG:4326",
                "parameters": {
                    "transparent": "true",
                    "format": "image/png"
                },
                "showClickFeature": true,
                "pickFeatureStyle": {//选择的要素样式，同Draw类样式
                    "showTime": 5000,
                    "clampToGround": true,
                    "fill": true,
                    "color": "#2deaf7",
                    "opacity": 0.6,
                    "outline": true,
                    "outlineWidth": 3,
                    "outlineColor": "#e000d9",
                    "outlineOpacity": 1.0
                },
                "getFeatureInfoParameters": {
                    "feature_count": 10
                },
                "popup": "all",
                // "popupPosition":{"top":10,"left":10 }, //固定再左侧位置，不浮动 ，数值对应top/btoom、left/right
                "click": function (features, viewerPoint) {
                    console.log("单击了矢量数据，共" + features.length + "条")

                },
                "visible": true,
            });

            // setTimeout(function () {
            //      layerWork.layer.imageryProvider.reinitialize({url:"https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?"});
            //      layerWork.layer.imageryProvider._reload(); 
            // }, 3000)


 

        }




 

    </script>
</body>

</html>